<?php /*a:2:{s:60:"D:\phpstudy_pro\WWW\git\DSMall\app\admin\view\link\form.html";i:1591845922;s:64:"D:\phpstudy_pro\WWW\git\DSMall\app\admin\view\public\header.html";i:1591845922;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>DSMall<?php echo htmlentities(lang('system_backend')); ?></title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/css/admin.css">
        <link rel="stylesheet" href="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.css">
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery-2.1.4.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.validate.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.cookie.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/common.js"></script>
        <script src="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/js/admin.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/perfect-scrollbar.min.js"></script>
        <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/layer/layer.js"></script>
        <script type="text/javascript">
            var BASESITEROOT = "<?php echo htmlentities(BASE_SITE_ROOT); ?>";
            var ADMINSITEROOT = "<?php echo htmlentities(ADMIN_SITE_ROOT); ?>";
            var BASESITEURL = "<?php echo htmlentities(BASE_SITE_URL); ?>";
            var HOMESITEURL = "<?php echo htmlentities(HOME_SITE_URL); ?>";
            var ADMINSITEURL = "<?php echo htmlentities(ADMIN_SITE_URL); ?>";
        </script>
    </head>
    <body>
        <div id="append_parent"></div>
        <div id="ajaxwaitid"></div>







<div class="page">
    <form id="link_form" enctype="multipart/form-data" method="post">
        <input type="hidden" name="link_id" value="<?php echo htmlentities($link['link_id']); ?>" />
        <input type="hidden" name="old_link_pic" value="<?php echo htmlentities($link['link_pic']); ?>" />
        <table class="ds-default-table">
            <tbody>
            <tr class="noborder">
                <td class="required w120"><label class="validation" for="link_title"><?php echo htmlentities(lang('link_title')); ?>:</label></td>
                <td class="vatop rowform"><input type="text" value="<?php echo htmlentities($link['link_title']); ?>" name="link_title" id="link_title" class="txt"></td>
                <td class="vatop tips"><?php echo htmlentities(lang('link_add_name')); ?></td>
            </tr>
            <tr class="noborder">
                <td class="required"><label class="validation" for="link_url"><?php echo htmlentities(lang('ds_link')); ?>:</label></td>
                <td class="vatop rowform"><input type="text" value="<?php echo htmlentities($link['link_url']); ?>" name="link_url" id="link_url" class="txt"></td>
                <td class="vatop tips"><?php echo htmlentities(lang('link_add_href')); ?></td>
            </tr>
            <tr class="noborder">
                <td class="required"><label for=""><?php echo htmlentities(lang('link_pic')); ?>:</label></td>
                <td class="vatop rowform">
                    <?php if(!(empty($link['link_pic']) || (($link['link_pic'] instanceof \think\Collection || $link['link_pic'] instanceof \think\Paginator ) && $link['link_pic']->isEmpty()))): ?>
                    <span class="type-file-show">
                        <img class="show_image" src="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/images/preview.png">
                        <div class="type-file-preview"><img src="<?php echo htmlentities(BASE_SITE_ROOT); ?>/uploads/admin/link/<?php echo htmlentities($link['link_pic']); ?>"></div>
                    </span>
                    <?php endif; ?>
                    <span class="type-file-box">
                        <input name="link_pic" type="file" class="type-file-file" id="link_pic" size="30">
                    </span>
                </td>
                <td class="vatop tips">
                    <?php if($link['link_pic'] == ''): ?>
                   <span class='red'><?php echo htmlentities(lang('link_add_tosign')); ?></span>
                    <?php endif; ?>
                </td>
            </tr>
            <tr class="noborder">
                <td class="required"><label for="link_sort"><?php echo htmlentities(lang('ds_sort')); ?>:</label></td>
                <td class="vatop rowform"><input type="text" value="<?php echo htmlentities($link['link_sort']); ?>" name="link_sort" id="link_sort" class="txt"></td>
                <td class="vatop tips"><?php echo htmlentities(lang('link_add_sort_tip')); ?></td>
            </tr>
            <tfoot>
            <tr class="tfoot">
                <td colspan="15"><input class="btn" type="submit" value="<?php echo htmlentities(lang('ds_submit')); ?>"/></td>
            </tr>
            </tfoot>
        </table>
    </form>
</div>
<script>
    //按钮先执行验证再提交表单
    $(function(){
        $('#link_form').validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules : {
                link_title : {
                    required : true
                },
                link_url  : {
                    required : true,
                    url      : true
                },
                link_sort : {
                    number   : true
                }
            },
            messages : {
                link_title : {
                    required : '<?php echo htmlentities(lang('link_add_title_null')); ?>'
                },
                link_url  : {
                    required : '<?php echo htmlentities(lang('link_add_url_null')); ?>',
                    url      : '<?php echo htmlentities(lang('link_add_url_wrong')); ?>'
                },
                link_sort  : {
                    number   : '<?php echo htmlentities(lang('link_add_sort_int')); ?>'
                }
            }
        });
    });
</script>
<script type="text/javascript">
    $(function(){
        var textButton="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='上传' class='type-file-button' />"
        $(textButton).insertBefore("#link_pic");
        $("#link_pic").change(function(){
            $("#textfield1").val($("#link_pic").val());
        });
    });
</script>